/*
 * @Author: your name
 * @Date: 2021-06-26 22:21:23
 * @LastEditTime: 2021-06-26 22:28:12
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 */

import { Entity } from "./Entity";
import { EntityPart } from "./EntityPart";

export class Player extends Entity {

    public constructor() {
        super();
    }

    private parts: { [key: string]: EntityPart } = {};
    /**
     * 获取部件
     * @param c 
     * @returns 
     */
    public Get<T extends EntityPart>(c: { new(): T; }): T {
        let uuid_sign = (c as any)["uuid_sign"];
        return this.parts[uuid_sign] as T;
    }
    /**
     * 获取部件
     * @param c 
     * @returns 
     */
    public Add(c: EntityPart) {
        this.parts[c.uuid_sign] = c;
    }
}